<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="/Xqkq/Public/Libs/easyui/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="/Xqkq/Public/Libs/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/Xqkq/Public/Libs/easyui/themes/color.css">
<script type="text/javascript" src="/Xqkq/Public/Libs/easyui/jquery.min.js"></script>
<script type="text/javascript"   src="/Xqkq/Public/Libs/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"   src="/Xqkq/Public/Libs/easyui/locale/easyui-lang-zh_CN.js"></script>



<!-- Plupload 引入文件 -->
<link rel="stylesheet" href="/Xqkq/Public/Libs/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
<script type="text/javascript" src="/Xqkq/Public/Libs/plupload/plupload.full.min.js"></script>
<script type="text/javascript" src="/Xqkq/Public/Libs/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
</head>

<body>

 <div class="easyui-tabs" style="width:100%;">
    <div title="网站流量" style="padding:10px">
        <div style="width: 700px; height: auto; margin:20px auto;">
            <canvas id="myChart"></canvas>
        </div>
        <div style="width:100%;text-align: center;">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:refresh();">刷新</a>
        </div>
    </div>

    <div title="服务器信息" style="padding:10px">
        <table id="sinfo" class="easyui-datagrid" title="服务器配置信息表" style="width:100%;"
        data-options="singleSelect:true,collapsible:false,url:'/Xqkq/admin.php/Dashboard/get_server_info',method:'post'"
        toolbar="#toolbar"
        pagination="true"
        rownumbers="true"
        fitColumns="true">
        <thead>
            <tr>
                <th data-options="field:'name',width:200">配置项</th>
                <th data-options="field:'value',width:400">详细值</th>
            </tr>
        </thead>
    </table>
    <div id="toolbar">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-refresh" plain="true" onclick="refreshServerConfig()">刷新</a>
    </div>
</div>

<div title="使用帮助" data-options="iconCls:'icon-help'" style="padding:10px">
    文档正在完善
</div>
</div>

<script src="/Xqkq/Public/Libs/chart/Chart.js"></script>
<script>

        //Get the context of the canvas element we want to select
        var ctx = document.getElementById("myChart").getContext("2d");
        var data = {
            labels: ["1", "2", "3", "4", "5", "6", "7",'8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'],
            datasets: [
            {
                fillColor: "rgba(220,220,220,0.5)",
                strokeColor: "rgba(220,220,220,1)",
                pointColor: "rgba(220,220,220,1)",
                pointStrokeColor: "#fff",
                data: <?php echo ($lastData); ?>
            },
            {
                fillColor: "rgba(151,187,205,0.5)",
                strokeColor: "rgba(151,187,205,1)",
                pointColor: "rgba(151,187,205,1)",
                pointStrokeColor: "#fff",
                data: <?php echo ($nowData); ?>
            }
            ]
        }
        new Chart(ctx).Line(data, {responsive: true});

        function refreshServerConfig() {
            $.post('/Xqkq/admin.php/Dashboard/refresh_server_info',function(result){
                if (result.success){
                    $('#sinfo').datagrid('reload');
                } else {
                    $.messager.show({ // show error message
                        title: 'Error',
                        msg: result.errorMsg
                    });
                }
            },'json');
        }

        function refresh() {
            location.reload();
        }

    </script>

</body>
</html>